package com.mate.cloud.auth.utils;


import com.mate.cloud.core.common.constant.TokenConstant;
import lombok.experimental.UtilityClass;
/**
 *  SecurityUtil工具类
 * @author:         MI
 * @email:          448341911@qq.com
 * @createTime:     2025/1/31 16:00
 * @updateUser:     MI
 * @updateTime:     2025/1/31 16:00
 * @updateRemark:   修改内容
 * @version:        v1.0
 */
@UtilityClass
public class SecurityUtils {

    public static String BEARER = TokenConstant.BEARER;

    public Integer AUTH_LENGTH = 7;
    /**
     * 获取token串
     *
     * @param auth token
     * @return String
     */
    public static String getToken(String auth) {
        if ((auth != null) && (auth.length() > AUTH_LENGTH)) {
            String headStr = auth.substring(0, 6).toLowerCase();
            if (headStr.compareTo(BEARER) == 0) {
                auth = auth.substring(7);
            }
            return auth;
        }
        return null;
    }

}
